Skip to content

fix: guard against nil transaction#499

Merged
wolf31o2 merged 1 commit intomainfrom
fix/guard-nil-tx
Nov 29, 2025
Merged

fix: guard against nil transaction#499
wolf31o2 merged 1 commit intomainfrom
fix/guard-nil-tx

Conversation

@wolf31o2
Copy link
Copy Markdown
Member

@wolf31o2 wolf31o2 commented Nov 29, 2025

Summary by cubic

Add a nil check in SubmitTx and return "transaction is required" when the request has no tx. This prevents crashes from nil dereferences on invalid client requests.

Written for commit 814856a. Summary will update automatically on new commits.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced transaction submission validation to properly reject missing or invalid transaction data with a clear error message, preventing potential processing errors.

✏️ Tip: You can customize this high-level summary in your review settings.

Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
@wolf31o2 wolf31o2 requested a review from a team as a code owner November 29, 2025 16:24
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 29, 2025

📝 Walkthrough

Walkthrough

A nil-check was added to the SubmitTx function in internal/utxorpc/submit.go. When the transaction payload (txRaw) is nil, the function now returns early with an error message "transaction is required" instead of proceeding with execution. This implements input validation using a fail-fast pattern.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

  • Single file modified with a straightforward guard clause
  • No changes to function signatures or exported entities
  • Defensive input validation with clear error messaging

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: guard against nil transaction' accurately and concisely describes the main change: adding a nil-check for transaction payloads in the SubmitTx function.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/guard-nil-tx

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 16888c8 and 814856a.

📒 Files selected for processing (1)
  • internal/utxorpc/submit.go (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Analyze (go)
🔇 Additional comments (1)
internal/utxorpc/submit.go (1)

45-48: Nil transaction guard correctly prevents nil dereference

Adding the early return when txRaw is nil cleanly avoids a potential panic at txRaw.GetRaw() and enforces a clear “transaction is required” contract for callers. The change is minimal, consistent with existing error handling, and introduces no new edge cases in SubmitTx.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@wolf31o2 wolf31o2 merged commit 50799ff into main Nov 29, 2025
12 checks passed
@wolf31o2 wolf31o2 deleted the fix/guard-nil-tx branch November 29, 2025 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants